home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / tutorials / geometer / describe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  5.9 KB  |  197 lines

  1. /*
  2.  * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17.  
  18. #include "parse.h"
  19.  
  20. void            describeprimitive(primitive *p)
  21. {
  22.     char desc[200];
  23.     char n1[50], n2[50], n3[50], n4[50], n5[50];
  24.     char n[50];
  25.     
  26.     if (p->name[0])
  27.         sprintf(n, "\"%s\"", p->name);
  28.     else
  29.         sprintf(n, "(%s)", p->st->symbol);
  30.     if (p->c.p1) {
  31.     if (p->c.p1->name[0])
  32.         sprintf(n1, "\"%s\"", p->c.p1->name);
  33.     else
  34.         sprintf(n1, "(%s)", p->c.p1->st->symbol);
  35.     }
  36.     if (p->c.p2) {
  37.     if (p->c.p2->name[0])
  38.         sprintf(n2, "\"%s\"", p->c.p2->name);
  39.     else
  40.         sprintf(n2, "(%s)", p->c.p2->st->symbol);
  41.     }
  42.     if (p->c.p3) {
  43.     if (p->c.p3->name[0])
  44.         sprintf(n3, "\"%s\"", p->c.p3->name);
  45.     else
  46.         sprintf(n3, "(%s)", p->c.p3->st->symbol);
  47.     }
  48.     if (p->c.p4) {
  49.     if (p->c.p4->name[0])
  50.         sprintf(n4, "\"%s\"", p->c.p4->name);
  51.     else
  52.         sprintf(n4, "(%s)", p->c.p4->st->symbol);
  53.     }
  54.     if (p->c.p5) {
  55.     if (p->c.p5->name[0])
  56.         sprintf(n5, "\"%s\"", p->c.p5->name);
  57.     else
  58.         sprintf(n5, "(%s)", p->c.p5->st->symbol);
  59.     }
  60.  
  61.     switch (p->c.type) {
  62.         case NULLCONSTRAINT:
  63.         break;
  64.         case VERTFREE:
  65.         sprintf(desc, "%s: free vertex", n);
  66.         break;
  67.         case VERTONLINE:
  68.         sprintf(desc, "%s: vertex on line %s", n, n1);
  69.         break;
  70.         case VERTONCIRCLE:
  71.         sprintf(desc, "%s: vertex on circle %s", n, n1);
  72.         break;
  73.     case VERTONCONIC:
  74.         sprintf(desc, "%s: vertex on conic %s", n, n1);
  75.         break;
  76.         case VERTDISTFROMLINE:
  77.         break;
  78.         case VERTLINELINE:
  79.         sprintf(desc, "%s: intersection of lines %s and %s", n, n1, n2);
  80.         break;
  81.         case VERTLINECIRC1:
  82.         case VERTLINECIRC2:
  83.         sprintf(desc, "%s: intersection of line %s and circle %s", n, n1, n2);
  84.         break;
  85.     case VERTLINEVERTMIRROR:
  86.         sprintf(desc, "%s: mirror through line %s of vertex %s", n, n1, n2);
  87.         break;
  88.         case VERTCIRCCIRC1:
  89.         case VERTCIRCCIRC2:
  90.         sprintf(desc, "%s: intersection of circles %s and %s", n, n1, n2);
  91.         break;
  92.         case VERTCIRCCENTER:
  93.         sprintf(desc, "%s: center of circle %s", n, n1);
  94.         break;
  95.         case VERTVERTVERTMID:
  96.         sprintf(desc, "%s: midpoint of vertices %s and %s", n, n1, n2);
  97.         break;
  98.         case LINEVERTVERT:
  99.         sprintf(desc, "%s: line connecting vertices %s and %s", n, n1, n2);
  100.         break;
  101.         case LINEVERTLINEPAR:
  102.         sprintf(desc, "%s: line through %s parallel to %s", n, n1, n2);
  103.         break;
  104.         case LINEVERTLINEPERP:
  105.         sprintf(desc, "%s: line through %s perpendicular to %s", n, n1, n2);
  106.         break;
  107.         case LINEVERTCIRC1:
  108.         case LINEVERTCIRC2:
  109.         sprintf(desc, "%s: line through %s tangent to circle %s", n, n1, n2);
  110.         break;
  111.         case LINELINEPERPCIRC:
  112.         case LINELINEPARCIRC:
  113.         break;
  114.         case LINECIRCCIRCEXT1:
  115.         case LINECIRCCIRCEXT2:
  116.         sprintf(desc, "%s: exterior tangent to circles %s and %s", n, n1, n2);
  117.         break;
  118.         case LINECIRCCIRCINT1:
  119.         case LINECIRCCIRCINT2:
  120.         sprintf(desc, "%s: interior tangent to circles %s and %s", n, n1, n2);
  121.         break;
  122.         case CIRCVERTCIRC:
  123.         case CIRCVERTLINE:
  124.         case CIRCVERTVERT:
  125.         break;
  126.         case CIRCVERTDIST:
  127.         break;
  128.         case CIRCVERTVERTVERT:
  129.         sprintf(desc, "%s: circle through vertices %s, %s and %s", n, n1, n2, n3);
  130.         break;
  131.         case CIRCLINELINELINE1:
  132.         case CIRCLINELINELINE2:
  133.         case CIRCLINELINELINE3:
  134.         case CIRCLINELINELINE4:
  135.         sprintf(desc, "%s: circle tangent to lines %s, %s and %s", n, n1, n2, n3);
  136.         break;
  137.         case CIRCCIRCCIRCCIRC:
  138.         case CIRCVERTVERTLINE:
  139.         case CIRCVERTVERTCIRC:
  140.         case CIRCLINELINEVERT:
  141.         case CIRCLINELINECIRC:
  142.         case CIRCCIRCCIRCVERT:
  143.         case CIRCCIRCCIRCLINE:
  144.         case CIRCVERTLINECIRC:
  145.         break;
  146.         case CIRCCIRCCIRCINV:
  147.         sprintf(desc, "%s: circle inverse of circle %s, through circle %s", n, n1, n2);
  148.         break;
  149.         case CIRCLINECIRCINV:
  150.         sprintf(desc, "%s: circle inverse of line %s, through circle %s", n, n1, n2);
  151.         break;
  152.         case BEZVERTVERTVERTVERT:
  153.         sprintf(desc, "%s: bezier with control vertices %s, %s, %s, and %s", n, n1, n2, n3, n4);
  154.         case BSPVERTVERTVERTVERT:
  155.         break;
  156.         case RATIOVERTVERTVERT:
  157.         case VERTVERTVERTRATIO:
  158.         case LENVERTVERT:
  159.         break;
  160.         case CIRCVERTLEN:
  161.         sprintf(desc, "%s: circle with center %s and length radius", n, n1);
  162.         break;
  163.         case LENPLUSLENLEN:
  164.         case LENMINUSLENLEN:
  165.         case ANGLEVERTVERTVERT:
  166.         case VERTANGLEVERTVERT:
  167.         sprintf(desc, "%s: vertex an angle offset from %s and %s", n, n1, n2);
  168.         break;
  169.         case ANGLEANGLETRISECT:
  170.         case ANGLEANGLELEN:
  171.         case ANGLEFLOAT:
  172.         case LENFLOAT:
  173.         case LENTIMESLENLEN:
  174.         case LENDIVLENLEN:
  175.     case LENANGLE:
  176.         break;
  177.     case CONICFIVEVERT:
  178.         sprintf(desc, "%s: conic through verts: %s,  %s,  %s,  %s, %s", n, n1, n2, n3, n4, n5);
  179.         break;
  180.     case CONICFIVELINE:
  181.         sprintf(desc, "%s: conic through lines: %s,  %s,  %s,  %s, %s", n, n1, n2, n3, n4, n5);
  182.         break;
  183.     case LINETANGENTCONIC1:
  184.     case LINETANGENTCONIC2:
  185.         sprintf(desc, "%s: line tangent to conic %s through %s", n, n1, n2);
  186.         break;
  187.     case VERTCIRCVERTINV:
  188.         sprintf(desc, "%s: vertex %s inverted through %s", n, n1, n2);
  189.         break;
  190.     case VERTLINECONIC1:
  191.     case VERTLINECONIC2:
  192.         sprintf(desc, "%s: vertex intersection of line %s and conic %s", n, n1, n2);
  193.         break;
  194.     }
  195.     displaymessage(desc);
  196. }
  197.